package com.yitao.client.constant;

import java.util.HashMap;
import java.util.Map;

public class ActivityEnums {

    /**
     * 未发布 0 已经发布 1 已经结束 2
     */
    public enum ActivityStatesEnum {

        UNPUBLISHED(0, "已发布"),
        RELEASE(1, "未发布"),
        END(2, "已经结束");

        private static final Map<Integer, ActivityStatesEnum> map = new HashMap<>();

        static {
            ActivityStatesEnum[] values = ActivityStatesEnum.values();
            for (ActivityStatesEnum item : values) {
                map.put(item.code, item);
            }
        }

        private final Integer code;
        private final String name;

        private ActivityStatesEnum(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static ActivityStatesEnum getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

}
